#
#
"""
Workflow for Online Community Survey types
"""
__version__ = "$Revision: 1.1.1.1 $"[11:-2]

from Products.CMFCore.WorkflowTool import addWorkflowFactory
from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
from Products.ArchSurvey.Permissions import *

def setup_surveyQuestionWorkflow(wf):
	"..."
	wf.setProperties(title='Survey Question Workflow')

	for s in ['basic']:
		wf.states.addState(s)

	for p in (EDIT_CONTENT_PERMISSION,
			  VIEW_CONTENT_PERMISSION,
			  VIEW_RESULTS,
			  ACCESS_CONTENTS,
			  TAKE_SURVEY):
		wf.addManagedPermission(p)
		
	## Initial State
	wf.states.setInitialState('basic')
	
	## State Variable
	wf.variables.setStateVar('review_state')

	## States initialization	
	sdef = wf.states['basic']
	sdef.setProperties(title="Basic")
	sdef.setPermission(EDIT_CONTENT_PERMISSION, 1,[])
	sdef.setPermission(VIEW_CONTENT_PERMISSION, 1, [])
	sdef.setPermission(ACCESS_CONTENTS, 1, [])
	sdef.setPermission(VIEW_RESULTS, 1, [])
	sdef.setPermission(TAKE_SURVEY, 1, [])	
		
def create_surveyQuestionWorkflow(id):
	"..."
	ob = DCWorkflowDefinition(id)
	setup_surveyQuestionWorkflow(ob)
	return ob

survey_question_workflow_id='survey_question_workflow'
survey_question_workflow='survey_question_workflow (Survey Question Workflow [Survey])'

addWorkflowFactory(create_surveyQuestionWorkflow,
				   id=survey_question_workflow_id,
				   title='Survey Question Workflow [Survey]')	
